package com.qf.impl;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qf.IBrandService;
import com.qf.entity.Brand;
import com.qf.mapper.BrandMapper;
import com.qf.model.Result;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class BrandServiceImpl implements IBrandService {
    private BrandMapper brandMappr;

    public BrandServiceImpl(BrandMapper brandMappr) {
        this.brandMappr = brandMappr;
    }

    @Override
    public Result findAllBrand(int currentPage, int pageSize) {
        Page<Brand> page = PageHelper.startPage(currentPage, pageSize);
        brandMappr.selectList(Wrappers.emptyWrapper());
        Map<String, Object> data = new HashMap<>();
        data.put("total", page.getTotal());
        data.put("users", page.getResult());
        return Result.buildSuccess(data);

    }


}
